

use crate::{event_info, function::input:: MouseButton, math::Vector2f};

use super::event_type::{Event, EventCategory, EventType, StaticEvent};


event_info! {
    pub struct MouseMoveEvent {
        handle: bool,
        pos:    Vector2f
    },
    EventType::MouseMoved,
    EventCategory::EventCategoryMouse
}

impl MouseMoveEvent {
    pub fn new(pos:Vector2f) -> Self {
        Self { handle: false, pos }
    }

 
    pub fn get_cursor_pos(&self) -> Vector2f {
        self.pos
    }
}


event_info! {
    pub struct MouseScrollEvent {
        handle:     bool,
        offset:     Vector2f,
    },
    EventType::MouseScrolled,
    EventCategory::EventCategoryMouse
}


impl MouseScrollEvent {
    pub fn new(offset:Vector2f) -> Self {
        Self { handle: false, offset }
    }

    pub fn get_wheel_delta(&self) -> Vector2f {
        self.offset
    }

    pub fn get_wheel_y(&self) -> f32 {
        self.offset.y
    }


}


event_info! {
    pub struct MouseButtonPressedEvent {
        handle:     bool,
        button:     MouseButton
    },
    EventType::MouseButtonPressed,
    EventCategory::EventCategoryMouseButton
}



impl MouseButtonPressedEvent {
    pub fn new(button:MouseButton) -> Self {
        Self { handle: false, button }
    }

    pub fn get_button(&self) -> MouseButton {
        self.button
    }
}


event_info! {
    pub struct MouseButtonReleasedEvent {
        handle:     bool,
        button:     MouseButton
    },
    EventType::MouseButtonReleased,
    EventCategory::EventCategoryMouseButton
}



impl MouseButtonReleasedEvent {
    pub fn new(button:MouseButton) -> Self {
        Self { handle: false, button }
    }

    pub fn get_button(&self) -> MouseButton {
        self.button
    }
}
